import { _decorator, Component, Input, input, Node } from 'cc';
import { FishingRod } from './FishingRod';
const { ccclass, property } = _decorator;

@ccclass('FishController')
export class FishController extends Component {

    @property(FishingRod)
    fishRod: FishingRod = null!;

    start() {
        input.on(Input.EventType.KEY_DOWN, this.keyDown, this);
        input.on(Input.EventType.KEY_UP, this.keyUp, this);


    }

    protected onDestroy(): void {
        input.off(Input.EventType.KEY_DOWN, this.keyDown, this);
        input.off(Input.EventType.KEY_UP, this.keyUp, this);
    }

    update(deltaTime: number) {

    }

    keyDown() {
        this.fishRod.changeState(true);
    }

    keyUp() {
        this.fishRod.changeState(false);
    }
}


